﻿@{
    Layout = "~/Views/Shared/_Index.cshtml";
}
@inject Microsoft.AspNetCore.Hosting.IWebHostEnvironment HostingEnvironment

<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="dept-form">
                <div class="select-list">
                    <ul>
                        <li>
                            地点名称：<input id="AreaName" name="AreaName" type="text" />
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.treeTable.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        @*<div class="btn-group-sm" id="toolbar" role="group">
            <a class="btn btn-success" onclick="$.operate.add(100)" shiro:hasPermission="system:dept:add">
                <i class="fa fa-plus"></i> 新增
            </a>
            <a class="btn btn-primary" onclick="$.operate.edit()" shiro:hasPermission="system:dept:edit">
                <i class="fa fa-edit"></i> 修改
            </a>
            <a class="btn btn-info" id="expandAllBtn">
                <i class="fa fa-exchange"></i> 展开/折叠
            </a>
        </div>*@
        <div class="col-sm-12 select-table table-striped">
            <table id="treeTable"></table>
        </div>
    </div>
</div>
<script type="text/javascript">
    $(function () {
        var options = {
            id: "treeTable",
            code: "areaCode",//父级
            parentCode: "parentAreaCode", //子级
            expandColumn: '2', //在哪一列上面显示展开按钮
            uniqueId: "id",
            expandAll: false,
            expandFirst: false,
            url: "/SystemManage/Area/GetListJson",
            createUrl: "/SystemManage/Area/AreaForm",
            updateUrl: "/SystemManage/Area/AreaForm",
            removeUrl: "/SystemManage/Area/DeleteFormJson?ids={id}",
            modalName: "行政区划", width: '20', widthUnit: '%',
            columns: [
                { field: 'id', visible: false },
                { field: 'selectItem', radio: true },
                { field: 'areaName', title: '地点名称', width: '50%' },
                { field: 'zipCode', title: '邮政编码', width: '25%', align: "left" },
                { field: 'areaLevel', title: '级别', width: '25%', align: "left" }
            ]
        };
        $.treeTable.init(options);
    });
</script>
